-- card: 12396 from stack: in.1 -- bmap block id: 12635 -- flags: 0000 -- background id: 10029 -- name: -- part 13 (field) -- low flags: 00 -- high flags: 0000 -- rect: left=6 top=143 right=183 bottom=109 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 65535 -- font id: 20 -- text size: 12 -- style flags: 0 -- line height: 12 -- part name: -- part contents for background part 11 ----- text ----- • The function findNext(theString) goes to the next card containing the string. It uses the find command because its so fast. It counts the number of cards the string has been found on, and lets you do whatever you want on each card it finds. findNext keeps track of the first card it found and tells you when you've gone all the way around the stack. To use findNext, declare "numberFound" to be a global variable. Set it to zero. FindNext("Abe") will return true if it found a new card with "Abe" on it. It returns false if there are no more cards with "Abe". Each time, "numberFound" has the number of cards "Abe" was found on. Example: Put this into your button script. on mouseUp --an example of using findNext() --count the number of cards with a word starting with "Abe" or whatever global numberFound put 0 into numberFound repeat while findNext("Abe") --"Abe" or whatever you choose end repeat put "Found on" && numberFound && "cards" into message end mouseUp Put this into your stack script. function findNext key --fast searching of a stack under program control. see example. --return true if we found a new occurance, false if done --numberFound will have the total we have found global numberFound, firstFound if (numberFound = 0) or (firstFound is empty) then return findFirst(key) go next card find key if the result is "not found" then put empty into firstFound return false end if if the ID of this card <> firstFound then add 1 to numberFound return true --we found another occurance else --we wrapped around the stack put empty into firstFound return false end if end findNext function findFirst key --only called by findNext (not called by user) --because numberFound = 0, we know this is the first time global numberFound, firstFound if numberFound <> 0 then ask "You must put 0 into numberFound before calling findNext()"¬with "OK" return false end if find key if the result is "not found" then put empty into firstFound return false else --we found it put the ID of this card into firstFound put 1 into numberFound return true end if end findFirst You can put findNext() and its subroutine, findFirst(), into your home script. If you have stricter conditions on the cards you want to find, do your tests on each card that findNext finds.  -- part contents for background part 17 ----- text ----- Find Next: -- part contents for background part 18 ----- text ----- • by Ted Kaehler -- part contents for card part 13 ----- text ----- civilized searching controlled by your script -- part contents for background part 19 ----- text ----- volume 1 • number 6 • card 7 •